/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Forms;

import Controls.RenderInput;
import Core.GM;
import MathCore.Operands.Variable;
import java.util.Vector;

/**
 *
 * @author Александр
 */
public class GraphEditor extends Editor
{
	protected Variable var = new Variable(null, "x");

	public GraphEditor()
	{
		super();
		setWindowText(GM.FORM_CAPTION, "Graphics");
		proc.addVariable(var);
		addField("a", AddVar.TOP);
	}

	protected void initFields(){}

	protected RenderInput addField(String name, int align)
	{
		RenderInput inp = super.addField(name, align);
		inp.setStyle(RenderInput.STYLE_ONLY_NAME);
		return inp;
	}

	protected void initText()
	{
		super.initText();
		setWindowText(GM.PANEL_RIGHTSOFT, "Plot");
	}

	protected void exec()
	{
		Vector exp = new Vector();
		Vector vars = new Vector();

		for(int i=0; i<fields.size(); i++)
		{
			exp.addElement(((RenderInput)fields.elementAt(i)).getExpression());
			vars.addElement(((RenderInput)fields.elementAt(i)).attachedVar);
		}
		
		GraphShow gs = new GraphShow(exp, vars, var, proc);
	}
}
